package nl.haemers.collections.interfaces 
{	
	import nl.haemers.collections.interfaces.IIterable;
	
	/**
	 * ...
	 * @author Jonathan Haemers
	 */
	public interface ICollection extends IIterable
	{
		/**
		 * Add object to the collection
		 * @param	e
		 * @return retuns true when the collection changed as a result of the call. Returns false otherwise. 
		 */
		function add(e:Object) : Boolean;
		
		/**
		 * Because we can't create Generics it's not possible to specify a specific Generic.
		 * @param	collection
		 * @return
		 */
		function addAll(collection:ICollection) : Boolean;
		
		/**
		 * Empty the collection.
		 */
		function clear() : void;
		
		/**
		 * 
		 * @param	e
		 * @return
		 */
		function contains(e:Object) : Boolean;
		
		/**
		 * Returns true if this collection contains all of the objects in the specified collection.
		 * Because we can't create Generics it's not possible to specify a specific Generic.
		 * @param	collection
		 * @return
		 */
		function containsAll(collection:ICollection) : Boolean;
		
		/**
		 * Compares the object with the collection for equality.
		 * @param	e
		 * @return
		 */
		function equals(e:Object) : Boolean;
		
		/**
		 * Returns the hash code value for this collection.
		 * @return
		 */
		function hashCode() : int;
		
		/**
		 * Returns true if this collection contains no objects.
		 * @return
		 */
		function isEmpty() : Boolean;
		
		/**
		 *  Removes a single instance of the specified object from this collection, if it is present (optional operation).
		 * @param	e
		 * @return
		 */
		function remove(e:Object=null) : Boolean;
		
		/**
		 * Removes all of this collection's objects that are also contained in the specified collection (optional operation).
		 * Because we can't create Generics it's not possible to specify a specific Generic.
		 * @param	collection
		 * @return
		 */
		function removeAll(collection:ICollection) : Boolean;
		
		/**
		 * Retains only the objects in this collection that are contained in the specified collection (optional operation).
		 * Because we can't create Generics it's not possible to specify a specific Generic.
		 * @param	collection
		 * @return
		 */
		function retainAll(collection:ICollection) : Boolean;
		
		/**
		 *  Returns the number of objects in this collection.
		 * Made a getter of it instead of an method. Getters & Setters are faster then methods!
		 * @return
		 */
		function get size() : int;
		
		/**
		 * Returns an array containing all of the objects in this collection.
		 * @return
		 */
		function toArray() : Array;
		
		/**
		 * Not possible
		 * Because we can't create Generics it's not possible to specify a specific Generic.
		 */
		//Returns an array containing all of the objects in this collection; the runtime type of the returned array is that of the specified array.
		//function toArray(T[] a) : <T> T[];
		
		/**
		 * Returns the string representation of this {@code Collection}. The presentation
		 * has a specific format. It is enclosed by square brackets ("[]"). Elements
		 * are separated by ', ' (comma and space).
		 * @return
		 */
		function toString() : String;
	}
	
}